import { Route, Routes } from 'react-router-dom';
import BasicLayout from '../layouts/BasicLayout';
import Home from '../pages/Home';
import Community from '../pages/Community';
import User from '../pages/User';
import Seed from '../pages/Seed';
import Login from '../pages/Login';
import AuthRoute from '../components/AuthRoute';
import NewThreadPage from '../pages/NewThreadPage';
import ThreadPage from '../pages/ThreadPage';
import Register from '../pages/Register';
import SeedDetail from '../pages/SeedDetail';
import SearchResult from '../pages/SearchResult'; // 新增引入
import AdminLogin from '../pages/AdminLogin';
import Management from '../pages/Management';
import AdminTorrent from '../pages/AdminTorrent';
import AdminPromotions from '../pages/AdminPromotions';
import UserView from '../pages/UserView';
import NotificationList from '../pages/NotificationList';
import PostManagement from '../pages/PostManagement';
import ReportManagement from '../pages/ReportManagement';
import AssessmentManagement from '../pages/AssessmentManagement';

const AppRoutes = () => {
  return (
    <Routes>
      <Route path="/admin" element={<AdminLogin />} />
      <Route path="/admin/users" element={<Management />} />
      <Route path="/admin/torrents" element={<AdminTorrent />} />
      <Route path="/admin/promotions" element={<AdminPromotions />} />
      <Route path="/admin/posts" element={<PostManagement />} />
      <Route path="/admin/reports" element={<ReportManagement />} />
      <Route path="/admin/assessment" element={<AssessmentManagement />} />
      <Route path="/login" element={<Login />} />
      <Route path="/register" element={<Register />} />
      <Route
        path="/"
        element={
          <AuthRoute>
            <BasicLayout />
          </AuthRoute>
        }
      >
        <Route index element={<Home />} />
        <Route path="/notifications" element={<NotificationList />} />
        <Route path="/community" element={<Community />} />
        <Route path="/community/:id" element={<ThreadPage />} />
        <Route path="/community/new" element={<NewThreadPage />} />
        <Route path="/seed" element={<Seed />} />
        <Route path="/seed/:id" element={<SeedDetail />} />
        <Route path="user" element={<User />} />
        <Route path="user/:id" element={<UserView />} />
        <Route path="search" element={<SearchResult />} /> {/* 新增搜索结果路由 */}
      </Route>
    </Routes>
  );
};

export default AppRoutes;